<?php

class Grades extends Controller {
	
	function index()
	{
        $template = $this->loadView('grades/lista');
        $listagem = $this->loadModel('grades_model');
        $template->smarty->assign('lista',$listagem->listaGrades());
        $template->render();
	}
    
    function cadastro()
    {
        $listagem = $this->loadModel('grades_model');
        $template = $this->loadView('grades/cadastro');
        $template->smarty->assign('tamanhos', $listagem->listaTamanhos());
        $template->render();
    }
    
    function cadastrodb()
    {
       $template = $this->loadView('grades/lista');
       $template->smarty->assign('form', $_POST);
       if(isset($_POST['grpNom'])){
            $grade = $this->loadModel('grades_model');
            $grade->insertGrade();       
       }
       $template->render();
    }
    
    function editar()
    {
        $funcoes = $this->loadHelper('funcoes_gerais');
        $template = $this->loadView('marcas/marcas_edita');
        $template->smarty->assign('status', $funcoes->listaStatus('A'));
        $template->render();
    }
    
    function editardb()
    {
        
    }
    
    function excluir($grpCod = ''){
       $grade = $this->loadModel('grades_model');
       $grade->excluirGrade($grpCod);
    }
}
